package org.core.tliaswebmanagement;

import org.core.tliaswebmanagement.utils.AliyunOSSOperator;
import org.core.tliaswebmanagement.utils.AliyunOSSProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;

/*
 *非自定义bean无法使用@Component,需要使用@Bean注解
 */

@ServletComponentScan
@SpringBootApplication
public class TliasWebManagementApplication {

    public static void main(String[] args) {
        SpringApplication.run(TliasWebManagementApplication.class, args);
    }

    //形参为自定义javabean,省略了@Autowired.通过以下方法即可将非自定义bean交给Spring容器管理
    @Bean
    public AliyunOSSOperator aliyunOSSOperator(AliyunOSSProperties aliyunOSSProperties){
        return new AliyunOSSOperator(aliyunOSSProperties);
    }
}
